package com.wanglixia.pc;

import com.wanglixia.mobile.AuthUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;

/**
 * 功能描述:
 * <p>
 * Created by Mr.wang on 2017/9/17 11:17.
 */
@WebServlet("/pcLogin")
public class WxLogin extends HttpServlet {
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String backUrl = "http://icode.vicp.io/pcCallBack";
        String url = "https://open.weixin.qq.com/connect/qrconnect?" +
                "appid=" + AuthUtil.APPID +
                "&redirect_uri=" + URLEncoder.encode(backUrl) +
                "&response_type=code" +
                "&scope=snsapi_login" +
                "&state=STATE#wechat_redirect";
        resp.sendRedirect(url);
    }
}
